package com.mall.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mall.shop.entity.member.Member;
import com.mall.shop.mapper.MemberMapper;
import com.mall.shop.service.MemberService;
import org.springframework.stereotype.Service;

/**
 * (Member)表服务实现类
 *
 * @author 龙茶清欢
 * @since 2023-01-15 14:23:48
 */
@Service("memberService")
public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService {

    @Override
    public Member findMemberByMobile(String mobile) {
        LambdaQueryWrapper<Member> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Member::getMobile, mobile);
        return this.baseMapper.selectOne(queryWrapper);
    }

    @Override
    public Boolean register(Member member) {
        int result = this.baseMapper.insert(member);
        return result == 1;
    }
}

